from statistics import mean

import pandas as pd

def main():
    aqi_data=pd.read_csv('beijing_aqi.csv')
    #data=pd.DataFrame(aqi_data)
    #print(data.info())
   #print(max(data['aqi']))
    #print(min(data['aqi']))
    #print(mean(data['aqi']))
    top5=aqi_data.sort_values(by=['aqi']).head(5)
    print(top5)
    bottom5=aqi_data.sort_values(by=['aqi'],ascending=False).head(5)
    print(bottom5)
    top5.to_csv('beijing_top5.csv',index=False)
    bottom5.to_csv('beijing_bottom5.csv',index=False)

if __name__=='__main__':
    main()